Install memcached:
  pkg.installed:
    - name: memcached

Copy default memcached config:
  file.managed:
    - name: /etc/sysconfig/memcached
    - source: salt://memcached/files/memcached
    - template: jinja

  # Fix memcached config issue cased by Windows \r\n linebreaks
  cmd.run:
    - name: sed -i 's/\r$//' /etc/sysconfig/memcached

Create memcached log directory:
  file.directory:
    - name: /var/log/memcached
    - mode: 755
    - makedirs: True

Setup Memcached logrotate script:
  file.managed:
    - name: /etc/logrotate.d/memcached
    - source: salt://memcached/files/logrotate-memcached

Enable memcached service:
  service.running:
    - name: memcached
    - enable: True
    - listen:
      - file: /etc/sysconfig/memcached
